package Test2;

import Test1.Cat;

import java.util.Scanner;

public  class TestEatable {

    public static void main(String[] args) {
        /**
     //2.使用匿名内部类调用方法
        useEatable((new Eatable() {
            @Override
            public void eat() {
                System.out.println("匿名内部类实现了eat方法");
            }
        }));

        useEatable(()->{
            System.out.println("lambda实现了eat方法");
        });
    }
         */
        useEatable(new Eatable() {
            @Override
            public String eat() {
                return "吃完了，真好吃";
            }
        });

        useEatable(()->{
            return "lambda实现了";
        });

    }
        public static void useEatable(Eatable e){
           String result= e.eat();
            System.out.println("返回值是"+result);
        }
    }

